package cn.backpackerxl.server.impl;
import cn.backpackerxl.model.Source;
import cn.backpackerxl.server.SourceService;
import cn.backpackerxl.repo.SourceDao;
import cn.backpackerxl.easyJDBC.main.EasyJDBCRepository;

import java.util.List;
/**
 * @Author: backpackerxl
 * CreateTime: 2022/11/24
 * FileName: SourceServiceImpl
 **/
public class SourceServiceImpl implements SourceService {
	private final SourceDao sourcedao = (SourceDao) new EasyJDBCRepository(SourceDao.class).init();

	@Override
	public int add(Source source) {
		return sourcedao.save(source);
	}

	@Override
	public int edit(Source source) {
		return sourcedao.update(source);
	}

	@Override
	public int delete(Long id) {
		return sourcedao.remove(id);
	}

	@Override
	public Source selectById(Long id) {
		return sourcedao.findById(id);
	}

	@Override
	public List<Source> selectAll() {
		return sourcedao.findAll();
	}

}